﻿namespace FiftyOne.Foundation.Mobile.Detection.Wurfl.Handlers
{
    using System;

    internal class FirefoxHandler : RegexSegmentHandler
    {
        private const string REGEX = @"Mozilla/5.0\s*(?:\(([^;]*);?\s*U;\s*([^;]*);?\s*([^;]*);?\s*(?:rv.*);?\s*(?:.*)?\))(?:.*)Gecko/(?:[\d]+)?(?:.*)?Firefox/(\d.\w)(?:[\.\w]+)?\s*(.*)?";

        internal FirefoxHandler() : base(@"Mozilla/5.0\s*(?:\(([^;]*);?\s*U;\s*([^;]*);?\s*([^;]*);?\s*(?:rv.*);?\s*(?:.*)?\))(?:.*)Gecko/(?:[\d]+)?(?:.*)?Firefox/(\d.\w)(?:[\.\w]+)?\s*(.*)?", new int[] { 1, 1, 1, 2, 0 })
        {
        }

        protected internal override bool CanHandle(string userAgent)
        {
            return userAgent.Contains("Firefox");
        }
    }
}

